home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_item_healthsml.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  124 lines

  1. # Jones 3D Cog Script
  2. #
  3. # item_HealthSml.cog
  4. #
  5. # [RT]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ===================================================================
  10.  
  11. symbols
  12.  
  13. message    activated
  14. message    touched
  15. message    taken
  16. message    user0
  17.  
  18. cog        talkCog                    local
  19.  
  20. sound    foundSnd=INXJ154.wav    local
  21.  
  22. thing    player                    local
  23.  
  24. int        bin=49                    local
  25. int        bUnderwater                local
  26.  
  27. flex    health=333.33            local
  28.  
  29.  
  30. end
  31.  
  32. # ===================================================================
  33.  
  34. code
  35.  
  36. activated:
  37.  
  38.     player = GetSourceRef();
  39.     bUnderwater = BitTest(GetThingFlags(player), 0x02000000);
  40.  
  41.     StartCutscene(0);
  42.  
  43.     if (!bUnderwater)
  44.     {
  45.         talkCog = GetCogByIndex(0);
  46.         SendMessage(talkCog, 27);
  47.     }
  48.  
  49.     if (Rand() < 0.5)
  50.     {
  51.         SetExtCamOffset('0.15 -0.05 0.04');
  52.     }
  53.     else
  54.     {
  55.         SetExtCamOffset('-0.15 -0.05 0.04');
  56.     }
  57.     SetExtCamLookOffset('0.0 0.02 -0.01');
  58.  
  59.     return;
  60.  
  61. # -------------------------------------------------------------------
  62.  
  63. touched:
  64.  
  65.     player = GetSourceRef();
  66.  
  67.     if (GetInv(player, bin) < GetInvMax(player, bin))
  68.     {
  69.         TakeItem(GetSenderRef(), player);
  70.     }
  71.     else
  72.     {
  73.         EndCutscene();
  74.     }
  75.     
  76.     return;
  77.  
  78. # -------------------------------------------------------------------
  79.  
  80. taken:
  81.  
  82.     player = GetSourceRef();
  83.  
  84.     ChangeInv(player, bin, 1.0);
  85.     SetInvAvailable(player, bin, 1);
  86.     JonesInvItemChanged(bin);
  87.  
  88.     Sleep(1.0);
  89.  
  90.     if (!bUnderwater)
  91.         PlayVoice(player, foundSnd, 1.0, 0);
  92.  
  93.     EndCutscene();
  94.  
  95.     return;
  96.  
  97. # -------------------------------------------------------------------
  98.  
  99. user0:
  100.  
  101.     player = GetLocalPlayerThing();
  102.  
  103.     if (GetInv(player, bin) > 0)
  104.     {
  105.         if (GetHealth(player) < 1000)
  106.         {
  107.             # Clear the poisoned bit just in case
  108.             ClearActorFlags(player, 0x2000);
  109.  
  110.             # Use the health kit
  111.             HealThing(player, health);
  112.             ChangeInv(player, bin, -1);
  113.             
  114.             if (GetInv(player, bin) == 0)
  115.             {
  116.                 SetInvAvailable(player, bin, 0);
  117.             }
  118.         }
  119.     }
  120.     
  121.     return;
  122.  
  123. end
  124.